package com.zhang.learns.jpa;

import org.junit.Test;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.core.type.StandardAnnotationMetadata;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import java.lang.annotation.Annotation;
import java.util.Set;

/**
 * @author zhanghaolian
 * @date 2021/12/27 10:43
 */
@SpringBootApplication
//这个注解也可以不加，通过自动装配会默认加上
@EnableJpaRepositories
public class JpaApplication {
    public static void main(String[] args) {
        SpringApplication.run(JpaApplication.class, args);
    }

    @Test
    public void test1() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();


    }

    @Test
    public void test2() {

        StandardAnnotationMetadata standardAnnotationMetadata = new StandardAnnotationMetadata(JpaApplication.class);
        Set<String> metaAnnotationTypes = standardAnnotationMetadata.getMetaAnnotationTypes(SpringBootApplication.class.getName());

        System.out.println(metaAnnotationTypes);


        Annotation[] declaredAnnotations = SpringBootApplication.class.getDeclaredAnnotations();
        System.out.println(declaredAnnotations);
    }
}
